/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-05-25     vandoul       the first version
 */
#ifndef APPLICATIONS_SRV_TCP_H_
#define APPLICATIONS_SRV_TCP_H_

#ifdef __cplusplus
extern "C" {
#endif

struct srv_tcp_data {
    const char *addr;
    int port;
    int req_size;
    union {
        void *buff;
    }req;
    int rsp_size;
    union {
        void *buff;
    }rsp;
    uint32_t timeout_s;
    uint32_t timeout_us;
};

struct srv_tcp_config {
    int priority;
};

int srv_tcp_create(struct srv_tcp_config *cfg);
int srv_tcp_trans(int srv_num, struct srv_tcp_data *data);
int srv_tcp_start(int srv_num);
int srv_tcp_set_name(int srv_num, char *name);
int srv_tcp_set_addr(int srv_num, char *addr, int port);
int srv_tcp_get_srv_num(char *name);

#ifdef __cplusplus
}
#endif

#endif /* APPLICATIONS_SRV_TCP_H_ */
